# Julia Schule-Cloos Copyright (c) 2022
FROM rocker/tidyverse:4.1.3

# Path to the replaction files in the docker container
ENV REPLICATION_PATH=/home/rstudio/covid_fear_replication

# Set user, workdir, disable authentication and give user root privileges
USER root
WORKDIR /home/rstudio
ENV DISABLE_AUTH=true
ENV ROOT=true

ENV MRAN_BUILD_DATE=2022-07-05

# Install R package dependencies
RUN install2.r -r https://cran.microsoft.com/snapshot/${MRAN_BUILD_DATE} \
	--error \
	bookdown \
	markdown \
	pacman \
	kableExtra \
	Hmisc \
	RColorBrewer \
	tidymodels \
	modelsummary \
	tictoc \
	gridExtra \
	colorspace \
	scales \
	jcolors \
	showtext \
	embed \
	ggdist \
	distributional \
	janitor \
	xfun \
	benchmarkme

# copy files
COPY ./data $REPLICATION_PATH/data/
COPY ./Schulte-Cloos_Covid-19-Anxieties_CEE_Replication.Rmd $REPLICATION_PATH/Schulte-Cloos_Covid-19-Anxieties_CEE_Replication.Rmd
COPY ./Schulte-Cloos_Covid-19-Anxieties_CEE_Replication.html $REPLICATION_PATH/Schulte-Cloos_Covid-19-Anxieties_CEE_Replication.html


# Change ownership of replication files to 'rstudio' user to allow Knitting the file
RUN chown -R rstudio $REPLICATION_PATH && \
    chgrp -R rstudio $REPLICATION_PATH
